﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace FirstGame
{
    public class MainMenuScreen : MenuScreen
    {
        ButtonItem Newgame, Continue, Setting, Exit;
        
        public MainMenuScreen(ContentManager content, ScreenManager screenmanager, string background, string[] strTextures1, string[] strTextures2, Vector2 topleft)
        {
            TopLeft = topleft;
            Screenmanager = screenmanager;
            Background = content.Load<Texture2D>(background);


            Items = new List<MenuItem>();
            int nItems = strTextures1.Length;

            Newgame = new ButtonItem(content, this, strTextures1[0], strTextures2[0], new Vector2(100, TopLeft.Y),
                                            new Vector2(-250, TopLeft.Y), new Vector2(250, 50));
            Newgame.Selected += new EventHandler(Newgame_Selected);
            Items.Add(Newgame);
            Continue = new ButtonItem(content, this, strTextures1[1], strTextures2[1], new Vector2(100, TopLeft.Y+60),
                                            Newgame.SetRelativePosition(), new Vector2(250, 50));
            Continue.Selected += new EventHandler(Continue_Selected);
            Items.Add(Continue);
            Setting = new ButtonItem(content, this, strTextures1[2], strTextures2[2], new Vector2(100, TopLeft.Y+120),
                                            Continue.SetRelativePosition(), new Vector2(250, 50));
            Setting.Selected += new EventHandler(Setting_Selected);
            Setting.Focused += new EventHandler(Setting_Focused);
            Items.Add(Setting);
            Exit = new ButtonItem(content, this, strTextures1[3], strTextures2[3], new Vector2(100, TopLeft.Y+180),
                                            Setting.SetRelativePosition(), new Vector2(250, 50));
            Exit.Selected += new EventHandler(Exit_Selected);
            Items.Add(Exit);
            NItems = Items.Count;
             
        }

        void Setting_Focused(object sender, EventArgs e)
        {
            
        }

        void Setting_Selected(object sender, EventArgs e)
        {
            if (Screenmanager.Settingscreen.ScreenState == FirstGame.ScreenState.InActive)
            {
                Screenmanager.Settingscreen.ScreenState = ScreenState.Active;

            }
            else if (Screenmanager.Settingscreen.ScreenState == FirstGame.ScreenState.Active)
            {
                Screenmanager.Settingscreen.ScreenState = ScreenState.InActive;

            } 
        }

        void Exit_Selected(object sender, EventArgs e)
        {
            
        }

        

        void Continue_Selected(object sender, EventArgs e)
        {
            
        }

        void Newgame_Selected(object sender, EventArgs e)
        {
           
        }        
    }
}
